import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15


MainView {
    id: root
    width: 800
    height: 391
    GridLayout{ //root中放置一个行布局，布局中放置3个方块
        id: languagelayout
        anchors.centerIn: parent
        columnSpacing: 20 //间距
        rows: 1 //行数
        columns: 2 //列数

        Button
        {
            id:btnZeroCal
//            x: 192
//            y: 74
            Layout.row: 0
            Layout.column: 0
            Layout.preferredWidth: 185
            Layout.preferredHeight: 85
            background: Rectangle{
                border.width: 0
                color: "#7584C2"
                    }

            text: qsTr("零点标定")
            font.pixelSize: 25
            palette.buttonText: "white"
            onClicked: {
                if(mytables.pwdSwitch === 1){
                    myLoader.setSource("EnterPwdPanel.qml", {"enterViewUrl":"ZeroCalibration.qml","lastViewUrl":"CalPanel.qml"})
                }
                else{
                    bottomBar.selected=2
//                    myLoader.visible=false;
//                    myLoader.visible=true
                    myLoader.source="ZeroCalibration.qml"
                }
            }
        }

        Button
        {
            id:btnGainCal
//            x: 431
//            y: 213
            Layout.row: 0
            Layout.column: 1
            Layout.preferredWidth: 185
            Layout.preferredHeight: 85
            background: Rectangle{
                border.width: 0
                color: "#7584C2"
                    }

            text: qsTr("增益标定")
            font.pixelSize: 25
            palette.buttonText: "white"
            onClicked: {
                if(mytables.pwdSwitch === 1){
                    myLoader.setSource("EnterPwdPanel.qml", {"enterViewUrl":"GainCalibration.qml","lastViewUrl":"CalPanel.qml"})
                }
                else{
                    bottomBar.selected=2
//                    myLoader.visible=false;
//                    myLoader.visible=true
                    myLoader.source="GainCalibration.qml"
                }
            }
        }
//        Button
//        {
//            id:btnSettings
////            x: 192
////            y: 74
//            Layout.row: 1
//            Layout.column: 0
//            Layout.preferredWidth: 185
//            Layout.preferredHeight: 85
//            background: Rectangle{
//                border.width: 0
//                color: "#7584C2"
//                    }

//            text: qsTr("设置")
//            font.pixelSize: 25
//            palette.buttonText: "white"
//            onClicked: {
//                if(mytables.pwdSwitch === 1){
//                    myLoader.setSource("EnterPwdPanel.qml", {"enterViewUrl":"SingleSettings.qml","lastViewUrl":"CalPanel.qml"})
////                    myLoader.setsource="EnterPwdPanel.qml"
////                    var loadedItem = myLoader.item
////                    loadedItem.enterViewUrl="ZeroCalibration.qml"
////                    loadedItem.lastViewUrl="CalPanel.qml"
//                }
//                else{
//                    bottomBar.selected=2
//                    myLoader.setsource="SingleSettings.qml"
//                }
//            }
//        }
//        Button
//        {
//            id:btnDebug
////            x: 192
////            y: 74
//            Layout.row: 1
//            Layout.column: 1
//            Layout.preferredWidth: 185
//            Layout.preferredHeight: 85
//            background: Rectangle{
//                border.width: 0
//                color: "#7584C2"
//                    }

//            text: qsTr("调试")
//            font.pixelSize: 25
//            palette.buttonText: "white"
//            onClicked: {
//                if(mytables.pwdSwitch === 1){
//                    myLoader.setSource("EnterPwdPanel.qml", {"enterViewUrl":"Debug.qml","lastViewUrl":"CalPanel.qml"})
////                    myLoader.setsource="EnterPwdPanel.qml"
////                    var loadedItem = myLoader.item
////                    loadedItem.enterViewUrl="ZeroCalibration.qml"
////                    loadedItem.lastViewUrl="CalPanel.qml"
//                }
//                else{
//                    bottomBar.selected=2
//                    myLoader.setsource="Debug.qml"
//                }
//            }
//        }



    }
    Button
    {
        id:btnReturn
        x: 688
        y: 281
        //x: 675
        //y: 20
        width: 100
        height: 100
        background: Rectangle{
            border.width: 0
            color: "#B0B0D0"
                }

        text: qsTr("返回")
        font.pixelSize: 25
        palette.buttonText: "white"
        //Connections {
        //    target: btnReturn
            onClicked: {
                //rectangle.selectedView = 4
                bottomBar.selected=2
//                myLoader.visible=false;
//                myLoader.visible=true
                myLoader.source="FunctionPanel.qml"
            }
        //}
    }
    MyBuzyIndicator{
        anchors.centerIn: parent
        id: languageLoader
        visible:false
        z:101
    }
    Dialog {
        anchors.centerIn: parent
        id: languageSaveOKDialog
        //title: "提示"
        standardButtons: Dialog.Ok
        //title:qsTr("保存成功！")
        modal: true
        closePolicy: "CloseOnEscape"
 //       onAccepted: {
 //           normalParaSaveOKDialog.close()
 //           rectangle.selectedView = 0;
 //           bottomBar.selected = 0;
 //       }
        z:100
        //onRejected: console.log("Cancel clicked")
    }
}


